package kitty.main;


import com.example.kittyvszombie.R;


import android.os.Bundle;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.util.Log;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends Activity {
	
	private MainView panel;
	private MainThread thread;
	private static final String TAG = MainActivity.class.getSimpleName();


	@Override
    public void onCreate(Bundle mBundle) {
        super.onCreate(mBundle);
    	this.panel= new MainView(this);
    	thread=new MainThread(panel.getHolder(), panel);        		
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        setContentView(panel);
        Log.d(TAG, "View added");
    }
	
    @Override
    public void onConfigurationChanged(final Configuration newConfig) {
    	// TODO Auto-generated method stub
    	super.onConfigurationChanged(newConfig);
    }
 
	@Override
    protected void onPause() {
    	// TODO Auto-generated method stub
		Log.d(TAG, "Pausing...");
    	super.onPause();
    	((MainThread) thread).pause();
	}
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		Log.d(TAG, "Resuming...");
		super.onResume();
		((MainThread) thread).unpause();
	}

    

	@Override
	protected void onDestroy() {
		Log.d(TAG, "Destroying...");
		super.onDestroy();
	}

	@Override
	protected void onStop() {
		Log.d(TAG, "Stopping...");
		super.onStop();
		((MainThread) thread).pause();
	}

}
